<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/11/10 010
 * Time: 10:44
 */
namespace App\Duck;

abstract class Duck {

    public $flyBehavior;
    public $quackBehavior;

    public abstract function display();

    public function performFly() {
        $this->flyBehavior->fly();
    }

    public function performQuack() {
        $this->quackBehavior->quack();
    }

    public function swim() {
        echo("All ducks float, even decoys!<br />");
    }

    public function setFlyBehavior(FlyBehavior $flyBehavior){
        $this->flyBehavior = $flyBehavior;
    }

    public function setQuackBehavior(QuackBehavior $quackBehavior){
        $this->quackBehavior = $quackBehavior;
    }
}